IF EXISTS (SELECT 1
          FROM SYSOBJECTS
          WHERE  id = OBJECT_ID('USP_Update_staff')
          AND TYPE IN ('P','PC'))
   DROP PROCEDURE USP_Update_staff
GO

/****** Object:  StoredProcedure [dbo].[USP_Update_staff]    Script Date: 10/21/2010 21:22:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		Boonyarit
-- Create date: 10/11/2553
-- =============================================
CREATE PROCEDURE [dbo].[USP_Update_staff]
	-- Add the parameters for the stored procedure here
	@staff_title nvarchar(max),
	@staff_firstname nvarchar(max),
	@staff_lastname nvarchar(max),
	@group_user_code int,
	@department_code int,
	@staff_status_login int,
	@staff_code_update int,
	@staff_status int,
	@staff_code int,
	@staff_no nvarchar(5)
AS
BEGIN

	UPDATE	   [staff]
	SET		  [staff_no] = @staff_no
			  ,[staff_title] = @staff_title
			  ,[staff_firstname] = @staff_firstname
			  ,[staff_lastname] = @staff_lastname
			  ,[group_user_code] = @group_user_code
			  ,[department_code] = @department_code
			  ,[staff_status_login] = @staff_status_login
			  ,[staff_code_update] = @staff_code_update
			  ,[staff_status] = @staff_status
			  ,[update_datetime] = getdate()
	 WHERE	  staff_code = @staff_code

END

GO
